<template>
  <div class="Menu">
    <input type="checkbox" id="toggler" />
    <label for="toggler">
      <span class="hambuger-container">
        <span></span>
        <span></span>
      </span>
    </label>
    <div class="nav-items">
      <ul>
        <li>首页</li>
        <li>分类</li>
        <li>归档</li>
        <li>留言</li>
        <li>日记</li>
        <li>友链</li>
        <li>关于</li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "Menu",
};
</script>

<style scoped>
* {
  box-sizing: border-box;
  list-style: none;
}
.Menu {
  display: flex;
  margin-right: 5px;
  width: 55px;
  height: 50px;
  justify-content: center;
  align-items: center;
}

#toggler:checked + label .box {
  background-color: cyan;
}

#toggler {
  display: none;
}

.hambuger-container {
  display: block;
  width: 25px;
  height: 25px;
  position: relative;
  top: 12px;
  cursor: pointer;
}

.hambuger-container span {
  display: block;
  height: 3px;
  background-color: #fff;
  position: relative;
  transition: transform 0.3s ease-in-out, top 0.3s ease-in-out 0.3s;
  top: 0;
}

.hambuger-container span:nth-child(2) {
  margin-top: 7px;
}

#toggler:checked + label .hambuger-container span:nth-child(1) {
  transform: rotate(45deg);
  top: 5px;
  transition: top 0.3s ease-in-out, transform 0.3s ease-in-out 0.3s;
}

#toggler:checked + label .hambuger-container span:nth-child(2) {
  transform: rotate(-45deg);
  top: -5px;
  transition: top 0.3s ease-in-out, transform 0.3s ease-in-out 0.3s;
}

.nav-items {
  background-color: rgba(0, 0, 0, 0.9);
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 50px;
  left: 0;
  transform: scaleY(0);
  transition: transform 0.5s ease-in-out, opacity 0.4s ease-in-out 0.3s;
  transform-origin: 50% 0;
  opacity: 0;
  text-align: center;
  z-index: 999;
}

#toggler:checked ~ .nav-items {
  transform: scaleY(1);
  opacity: 1;
}

.nav-items ul {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
ul li {
  color: #fff;
}
.nav-items li {
  font-size: 1.4rem;
  margin-top: 3.4rem;
}
.nav-items li:nth-child(1) {
  margin-top: 0;
}
.nav-items li:hover {
  color: #409eff;
  cursor: pointer;
}
</style>